unit untCadParametros;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  cxContainer, cxEdit, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinCaramel,
  dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinFoggy,
  dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky,
  dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
  dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinPumpkin, dxSkinSeven,
  dxSkinSharp, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
  dxSkinSummer2008, dxSkinsDefaultPainters, dxSkinValentine,
  dxSkinXmas2008Blue, Menus, DB, Grids, DBGrids, StdCtrls, cxButtons,
  ADODB, cxLabel, cxTextEdit, cxDBEdit, cxGroupBox;

type
  TfrmCadParametros = class(TForm)
    cxGroupBox2: TcxGroupBox;
    edtNome: TcxDBTextEdit;
    Label2: TcxLabel;
    dtEdit: TADOTable;
    dtEditCdigo: TAutoIncField;
    dtEditFORM_CAIXA_PATH_BD: TWideStringField;
    dtEditFORM_CAIXA_USER: TWideStringField;
    dtEditFORM_CAIXA_SENHA: TWideStringField;
    dsCliente: TDataSource;
    cxButton2: TcxButton;
    Contas: TADOTable;
    dsContas: TDataSource;
    ContasConta: TWideStringField;
    ContasCliente: TWideStringField;
    ContasCNPJ: TWideStringField;
    ContasEndereco: TWideStringField;
    ContasBairro: TWideStringField;
    ContasCidade: TWideStringField;
    ContastxtUF: TWideStringField;
    ContasCEP: TWideStringField;
    ContasDataAss183: TWideStringField;
    ContasVlrMaxChq183: TBCDField;
    ContasVlrMaxDupl183: TBCDField;
    ContasContaCed: TWideStringField;
    ContasDataAss041: TWideStringField;
    ContasVlrMaxChq041: TBCDField;
    ContasVlrMaxDupl041: TBCDField;
    ContasVlrContrato041: TBCDField;
    ContasVlrContrato183: TBCDField;
    ContasBandaChq: TWordField;
    ContasDtExcepChq: TWideStringField;
    ContasBandaDup: TWordField;
    ContasDtExcepDup: TWideStringField;
    ContasTelefone: TWideStringField;
    ContasVlrContrato197: TBCDField;
    ContasDataConceito041: TWideStringField;
    ContasConceito041: TWideStringField;
    ContasVctoSIRIC: TDateTimeField;
    ContasEmail: TWideStringField;
    ContasEmail2: TWideStringField;
    ContasObservacoes: TMemoField;
    ContasTxDifChq: TFloatField;
    ContasTxDifDup: TFloatField;
    ContasVlrSaldo041: TBCDField;
    ContasDtSaldo041: TDateTimeField;
    ContasTAC041: TWideStringField;
    ContasVlrContrato734: TBCDField;
    ContasDataAss734: TDateTimeField;
    ContasContextPadrao: TMemoField;
    ContasCod_Contador: TFloatField;
    ContasContaCedGIM: TWideStringField;
    ContasDataConceito183: TWideStringField;
    ContasConceito183: TWideStringField;
    ContasEnviaEmail041: TWideStringField;
    ContasNum_Cedula183: TIntegerField;
    ContasNum_Cedula197: TIntegerField;
    ContasCodSICOB: TWideStringField;
    ContasVLRMAXDUPL_ESCR041: TBCDField;
    ContasCarteira: TIntegerField;
    ContasTelefone2: TWideStringField;
    ContasContato: TWideStringField;
    ContasDataSIRIC734: TDateTimeField;
    ContasDataAss194: TDateTimeField;
    ContasContaCaucao194: TWideStringField;
    ContasContaCedente194: TWideStringField;
    ContasVlrMaxChq194: TBCDField;
    ContasVlrMaxDup194: TBCDField;
    ContasNumEnde: TWideStringField;
    ContasComplEnde: TWideStringField;
    ContasExcepChq_Taxa: TWideStringField;
    ContasExcepDup_Taxa: TWideStringField;
    ContasQuantChq: TIntegerField;
    ContasQuantDuplConv: TIntegerField;
    ContasQuantDuplEsc: TIntegerField;
    cxButton3: TcxButton;
    ContasCodigo: TAutoIncField;
    procedure cxButton1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure cxButton3Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmCadParametros: TfrmCadParametros;

implementation

uses untDmPrincipal;

{$R *.dfm}

procedure TfrmCadParametros.cxButton1Click(Sender: TObject);
var
  Aux : Variant;
  caminho : string;
  aberto : boolean;
begin
  with dmPrincipal do
  begin
    if ConnectForm.Connected Then
      ConnectForm.Close;


     ConnectForm.ConnectionString   :='Provider=Microsoft.Jet.OLEDB.4.0;Password='+trim(dtEditFORM_CAIXA_SENHA.AsString)+';Data Source='+dtEditFORM_CAIXA_PATH_BD.Text+';Persist Security Info=True';
     ConnectForm.Connected := TRUE  ;

     if ConnectForm.Connected then
     begin
       Contas.Close;
       Contas.Connection := ConnectForm;
       Contas.Open;
     end;
  end;
end;

procedure TfrmCadParametros.FormCreate(Sender: TObject);
begin
  dtEdit.Open;
  dtEdit.Edit;
  
end;

procedure TfrmCadParametros.cxButton3Click(Sender: TObject);
begin
  dtEdit.Post;
end;

procedure TfrmCadParametros.cxButton2Click(Sender: TObject);
begin
  close;
end;

end.
